# Dustin Dannenhauer (dtdannen)
#
# This file allows the Users, Problems, and Contests tables 
# from the mysql db to be accessed and changed on the admin site

from contests.models import Problem, Contest, Submission
from django.contrib import admin

class ContestAdmin(admin.ModelAdmin):
    list_display = ('name','is_current')
    list_filter = ('name','author','is_current')
    filter_horizontal = ('problems',)
    
class SubmissionAdmin(admin.ModelAdmin):
    list_display = ('user','problem_name')
    list_filter = ('user','contest_name','is_correct','problem_name')
    search_fields = ('is_correct','user','problem_name','contest_name','timestamp')
    ordering = ('-timestamp',)
    readonly_fields = ('user','problem_name','is_correct','contest_name','timestamp','file_name')

class ProblemAdmin(admin.ModelAdmin):
    list_display = ('name','description','start_time','author')
    list_filter = ()

admin.site.register(Problem, ProblemAdmin)
admin.site.register(Contest, ContestAdmin)
admin.site.register(Submission, SubmissionAdmin)
